home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 001-025 / disk_003 / cforth / b2l.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  560b  |  25 lines

  1. /* usage: block2line < blockfile > linefile
  2.  * takes a block file from stdin and makes a cr-delimited file to stdout
  3.  * with 64 characters per line, 16 lines per screen
  4.  */
  5.  
  6. #include <stdio.h>
  7.  
  8. main()
  9. {
  10.     int i, j, screen;
  11.     char buf[64];    /* max line size */
  12.  
  13.     while(1) {
  14.         printf("------------------ SCREEN %d ------------------\n",
  15.             screen++);
  16.         for (i=0; i<16; i++) {
  17.         if (fread(buf,sizeof(char),64,stdin) < 64) exit(0);
  18.         j = 63;
  19.         while (buf[j] == ' ' && j >= 0) j--;
  20.         if (j >= 0) fwrite(buf,sizeof(char),j+1,stdout);
  21.         putchar('\n');
  22.         }
  23.     }
  24. }
  25.